#!/usr/bin/env python3

import json

import tmm.web.server.static as _static_files

DFLT_SERVER_ADDRESS = ""
DFLT_SERVER_PORT = "8000"

DFLT_MQ_HOST = "localhost"
DFLT_MQ_PORT = 5672

DFLT_MQ_AUX_USER = "guest"
DFLT_MQ_AUX_PASSWORD = "guest"
DFLT_MQ_VHOST = "/"
DFLT_MQ_HEARTBEAT = 30
DFLT_MQ_RECONNECT_DELAY = 1
DFLT_MQ_TCP_TIMEOUT = 60
DFLT_MQ_CACHE_SIZE = 4096

MIN_MQ_CACHE_SIZE = 1024

with open(_static_files.STATIC_FILES_DIRECTORY+"/server_configure.json",'r') as f:
    conf = json.load(f)
    # global DFLT_SERVER_PORT,DFLT_MQ_HOST,DFLT_MQ_PORT,DFLT_MQ_AUX_USER,DFLT_MQ_AUX_PASSWORD
    DFLT_SERVER_PORT = conf.get("server_port","8000")
    DFLT_MQ_HOST = conf.get("mq",{}).get("host","localhost")
    DFLT_MQ_PORT = int(conf.get("mq",{}).get("5672",5672))
    DFLT_MQ_AUX_USER = conf.get("user",{}).get("name","guest")
    DFLT_MQ_AUX_PASSWORD = conf.get("user", {}).get("name", "password")